/*    */ package com.gillion.grule.client.utils;
/*    */ 
/*    */ import com.gillion.grule.client.core.BusinessModel;
/*    */ import com.gillion.grule.client.core.Context;
/*    */ import com.gillion.grule.client.sync.DroolsRuleAssembly;
/*    */ import com.gillion.grule.client.sync.DroolsRulePackage;
/*    */ import org.kie.internal.runtime.StatefulKnowledgeSession;
/*    */ import org.slf4j.Logger;
/*    */ import org.slf4j.LoggerFactory;
/*    */ 
/*    */ 
/*    */ 
/*    */ public class DroolsRuleUtils
/*    */ {
/* 15 */   private static final Logger logger = LoggerFactory.getLogger(DroolsRuleUtils.class);
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */   
/*    */   public static void execute(DroolsRuleAssembly droolsRuleAssembly, Context context, BusinessModel businessModel, String childAssemblyName) {
/* 22 */     DroolsRuleAssembly childAssembly = (DroolsRuleAssembly)droolsRuleAssembly.getAssemblys().get(childAssemblyName);
/* 23 */     fireRuleAssembly(context, businessModel, childAssembly);
/*    */   }
/*    */ 
/*    */ 
/*    */ 
/*    */   
/*    */   public static void execute(DroolsRulePackage droolsRulePackage, Context context, BusinessModel businessModel, String childAssemblyName) {
/* 30 */     DroolsRuleAssembly childAssembly = (DroolsRuleAssembly)droolsRulePackage.getAssemblys().get(childAssemblyName);
/* 31 */     if (childAssembly == null) {
/* 32 */       logger.error("规则实体对象：" + droolsRulePackage);
/* 33 */       logger.error("规则集名称：" + childAssemblyName + ",当前规则集长度：" + droolsRulePackage.getAssemblys().size());
/*    */     } 
/* 35 */     fireRuleAssembly(context, businessModel, childAssembly);
/*    */   }
/*    */ 
/*    */   
/*    */   public static void fireRuleAssembly(Context context, BusinessModel businessModel, DroolsRuleAssembly childAssembly) {
/* 40 */     StatefulKnowledgeSession session = childAssembly.getKnowledgeBase().newStatefulKnowledgeSession();
/* 41 */     session.insert(context);
/* 42 */     session.insert(businessModel);
/* 43 */     session.insert(childAssembly);
/* 44 */     session.fireAllRules();
/* 45 */     session.dispose();
/*    */   }
/*    */ }


/* Location:              D:\apache-tomcat-9.0.76\webapps\grule-manager\WEB-INF\lib\grule-client-2.0.2.RELEASE.jar!\com\gillion\grule\clien\\utils\DroolsRuleUtils.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */